﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Application.Master" AutoEventWireup="true"
    CodeBehind="BusinessCardPaper.aspx.cs" Inherits="WebUI.BusinessCardPaper" Theme="POSSystem" %>
<%@ Register Assembly="AjaxControlToolkit" Namespace="AjaxControlToolkit" TagPrefix="cc1" %>
<%@ Register Src="~/Controls/SysControls/PageHeader.ascx" TagPrefix="uc" TagName="PageHeader" %>
<%@ Register Src="~/Controls/POSControls/PaperListCtrl.ascx" TagName="PaperList"
    TagPrefix="uc" %>
<%@ Register Src="~/Controls/POSControls/PaperPriceListCtrl.ascx" TagName="PaperPriceList"
    TagPrefix="uc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ApplicationHeadHolder" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="ApplicationContentHolder" runat="server">
    <script type="text/javascript">
        function onAddPaper() {
            var id = getSelectedItemID<%=lstPapers.ClientID %>();
            var returnValue = window.showModalDialog('<%=GetPaperEditPageLink() %>' + 'mode=new', '', 'dialogWidth=450px;dialogHeight=300px;resizable=no;help=no;unadorned=yes;');

            return returnValue > 0;
        }

        function onEditPaper() {
            var id = getSelectedItemID<%=lstPapers.ClientID %>();
            if(id == null){
                alert("No item was selected!");
                return false;
            }
            var returnValue = window.showModalDialog('<%=GetPaperEditPageLink() %>' + 'mode=edit&id=' + id, '', 'dialogWidth=450px;dialogHeight=300px;resizable=no;help=no;unadorned=yes;');
            return returnValue > 0;
        }

        function onRemovePaper() {
            var id = HasCheckedItems<%=lstPapers.ClientID %>();
            if(id == false){
                alert("No item was selected!");
                return false;
            }
            
            return confirm("This action will delete all checked items. Do you want to continue?");
        }

        function onRemovePrice() {
            var id = HasCheckedItems<%=lstPrice.ClientID %>();
            if(id == false){
                alert("No item was selected!");
                return false;
            }
            
            return confirm("This action will delete all checked items. Do you want to continue?");
        }

        function loadByPaperID(){
            var id = getSelectedItemID<%=lstPapers.ClientID %>();
            document.getElementById("<%=hidPaperID.ClientID %>").value = id;
            document.getElementById("<%=btnPaperID.ClientID %>").click();
        }
    </script>
    <uc:PageHeader ID="pageHeader" Text="Business Card Paper" ImageURL="~/Images/Paper.png"
        runat="server" />
    <table width="100%">
        <tr>
            <td style="width: 200px; text-align: left; vertical-align: top">
                <asp:UpdatePanel ID="updatePaper" runat="server" UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:Panel ID="panel1" runat="server" class="primaryPanel">
                            <div class="titleBar">
                                <asp:Label ID="Label1" runat="server" CssClass="titleContent">Business Card Paper</asp:Label>
                            </div>
                            <div class="primaryFrameNoBorder">
                                <table class="toolbar" width="100%">
                                    <tr>
                                        <td>
                                            <asp:LinkButton class="tbbutton" ID="btnAddPaper" runat="server" OnClientClick="return onAddPaper();"
                                                OnClick="btnAddPaper_OnClick">
                                                <img src="Images/AddRecord.gif" /><asp:Label ID="label2" runat="server" Text="Add"></asp:Label>
                                            </asp:LinkButton>
                                            <asp:LinkButton class="tbbutton" ID="btnEditPaper" runat="server" OnClientClick=" return onEditPaper();"
                                                OnClick="btnAddPaper_OnClick">
                                                <img src="Images/Edit.gif" /><asp:Label ID="label3" runat="server" Text="Edit"></asp:Label>
                                            </asp:LinkButton>
                                            <asp:LinkButton class="tbbutton" ID="btnRemovePaper" runat="server" OnClientClick="return onRemovePaper();"
                                                OnClick="btnRemovePaper_OnClick">
                                                <img src="Images/Delete.gif" /><asp:Label ID="label4" runat="server" Text="Delete"></asp:Label>
                                            </asp:LinkButton>
                                        </td>
                                    </tr>
                                </table>
                                <uc:PaperList ID="lstPapers" Width="100%" runat="server" AllowPaging="false" AllowSelecting="true"
                                    AllowSorting="true" SaveOnCommit="false" />
                            </div>
                        </asp:Panel>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
            <td style="width: 200px; text-align: left; vertical-align: top">
                <asp:UpdatePanel ID="UpdatePanel1" runat="server"  UpdateMode="Conditional">
                    <ContentTemplate>
                        <asp:Panel ID="panel2" runat="server" class="primaryPanel">
                            <div class="titleBar">
                                <asp:Label ID="Label5" runat="server" CssClass="titleContent">Quote</asp:Label>
                            </div>
                            <div class="primaryFrameNoBorder">
                                <div style='margin-bottom:10px' id="divPrice" runat="server" visible="false">
                                    <asp:Label ID="lblQuantity" runat="server" Tex="Quantity:" class="labelMessage">Quantity:</asp:Label>
                                    <asp:TextBox ID="txtQuantity" Width="80px" runat="server"></asp:TextBox>
                                    <asp:Label ID="Label6" runat="server" Tex="Unit Price" class="labelMessage">Unit Price:</asp:Label>
                                    <asp:TextBox ID="txtUnitPrice"  Width="80px" runat="server"></asp:TextBox>
                                    <asp:Button ID="btnAdd" Text="Add" runat="server" OnClick="btnAdd_OnClick" />
                                    <asp:Button ID="btnDelete" Text="Delete" runat="server" OnClick="btnDelete_OnClick" OnClientClick="return onRemovePrice();" />

                                    <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender1" TargetControlID="txtQuantity" FilterType="Numbers,Custom" ValidChars=".-" runat="server">
                                    </cc1:FilteredTextBoxExtender>
                                    <cc1:FilteredTextBoxExtender ID="FilteredTextBoxExtender2" TargetControlID="txtUnitPrice" FilterType="Numbers,Custom" ValidChars=".-" runat="server">
                                </cc1:FilteredTextBoxExtender>
                                </div>
                                <uc:PaperPriceList ID="lstPrice" Width="100%" runat="server" AllowPaging="false"
                                    AllowSelecting="true" AllowSorting="true" SaveOnCommit="false" />
                                <asp:HiddenField ID="hidPaperID" runat="server" />
                                <asp:Button Style="display: none" ID="btnPaperID" runat="server" OnClick="btnPaperID_OnClick" />
                            </div>
                        </asp:Panel>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>
</asp:Content>
